package com.xyz.eduservice.controller;

import com.xyz.entity.R;


import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * 登录
 * @author zsr
 * @date 2021/6/8 17:54
 */
@Schema(description="登录")
@CrossOrigin //解决跨域 用注解或网关
@RestController
@RequestMapping("/eduservice/user")
public class EduLoginController {

    @Schema(description = "登录")
    @PostMapping("login")
    public R login(){

        return R.ok().data("token","admin");
    }

    @Schema(description = "获取登录用户信息")
    @GetMapping("info")
    public R getInfo(){
        Map<String,String> map =new HashMap<>();
        map.put("roles","[admin]");
        map.put("name","admin");
        map.put("avatar","https://szy-education.oss-cn-shenzhen.aliyuncs.com/admin_head.jpg");
        return R.ok().data(map);
    }
}